import Foundation

protocol DWJsonDateValue {}
extension NSDate: DWJsonDateValue {}
extension Date: DWJsonDateValue {}

func dw_date(_ value: Any) -> DWJsonDateValue? {
    if let v = value as? Date { return v }
    guard let time = Double("\(value)") else { return nil }
    return Date(timeIntervalSince1970: time)
}
